﻿using System.Collections;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Collections.Generic
{
    [TestClass]
    public class WhenConvertingEnumerables
    {
        [TestMethod]
        public void TestConvert()
        {
            DerivedClass[] enumeration = new DerivedClass[] {new DerivedClass(), new DerivedClass()};

            IEnumerable<BaseClass> actual = EnumerableHelper.Convert<DerivedClass, BaseClass>(enumeration);
            Assert.IsTrue(EnumerableHelper.HaveSameElements(enumeration, actual));
        }

        [TestMethod]
        public void TestConvertIEnumerableToGeneric()
        {
            IEnumerable enumeration = new DerivedClass[] {new DerivedClass(), new DerivedClass()};

            IEnumerable<DerivedClass> actual = EnumerableHelper.Convert<DerivedClass>(enumeration);
            Assert.IsTrue(EnumerableHelper.HaveSameElements(actual, enumeration));
        }
    }
}